ggplot2 tips

몇 가지 ggplot2 팁 x가 factor일 때 geom_line() x가 factor일 때에는 geom_line()이 그려지지 않는다. 예를 들어, library(ggplot2) library(dplyr) dat = data.frame(gender=sample(c("M", "F"), 100, replace=TRUE), y = rnorm(100) + 10) datMean = dat %>% group_by(gender) %>% summarise(meany=mean(y)) dat %>% ggplot(aes(x=gender, y=y)) + geom_point(alpha=0.3) + geom_line(data=datMean, aes(x=gender, y=meany)) + geom_point(data=datMean, aes(x=gender, y=meany), size=3) ## geom_path: Each group … ggplot2 tips 계속 읽기